//
//  UnusualPollingViewController.m
//  GoldOperationClient
//
//  Created by yaxue wang on 2017/1/10.
//  Copyright © 2017年 展鸿科技. All rights reserved.
//

#import "UnusualPollingViewController.h"
#import "UnusualTableDetail.h"
#import "PollingCompleteTableViewController.h"
#import "PollingDetailViewController.h"

@interface UnusualPollingViewController ()

@end

@implementation UnusualPollingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navBar.leftView = nil;
    [self.navBar setHidden:YES];
    UIView *narView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, WindowWidth, 64)];
    narView.backgroundColor =[UIColor whiteColor];
    [self.view addSubview:narView];
    
    UIView *backView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, 120, 64)];
    [narView addSubview:backView];
    [backView bk_whenTapped:^{
        UINavigationController *navcontroller = self.navigationController;
        NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:navcontroller.viewControllers];
        
        for (UIViewController *temp in viewControllers)
        {
            if ([temp isKindOfClass:[PollingDetailViewController class]])
            {
                [self.navigationController popToViewController:temp animated:YES];
            }
        }
    }];
    
    UIImage *icoBack = [UIImage imageNamed:@"Ico_nar_back"];
    UIImageView *imgBack = [[UIImageView alloc] initWithFrame:CGRectMake(15, 33, icoBack.size.width, icoBack.size.height)];
    imgBack.image=icoBack;
    [backView addSubview:imgBack];
    UILabel *backTitle = [[UILabel alloc] init];
    backTitle.frame=CGRectMake(CGRectGetMaxX(imgBack.frame) + 5, 20,70,44);
    [backTitle setText:@"巡检详情"];
    [backTitle setTextColor:MainColor];
    [backTitle setFont:F(14)];
    [backView addSubview:backTitle];
    
    UILabel*titleLab =[[UILabel alloc]init];
    [narView addSubview:titleLab];
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(narView);
        make.top.equalTo(narView).offset(30);
    }];
    titleLab.font =F(16);
    titleLab.textColor =MainColor;
    titleLab.text=@"异常汇总";
    UnusualTableDetail *UnusualTableView=[[UnusualTableDetail alloc]initWithFrame:CGRectMake(0, 74, WindowWidth, WindowHeight-74)withUuid:self.Uuid];
    [self.view addSubview:UnusualTableView];
    
    [UnusualTableView setGotoDownward:^(NSString *string) {
        PollingCompleteTableViewController *networkVC=[[PollingCompleteTableViewController alloc]init];
        networkVC.passDic=self.passDic;
        networkVC.allAr=self.allAr;
        networkVC.Uuid=self.Uuid;
        networkVC.unusalState=self.unusualState;
        [self pushController:networkVC];
    }];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
